 package com.oanda.blackberry.ui;
 
 import net.rim.device.api.system.EncodedImage;
 import net.rim.device.api.system.GIFEncodedImage;
 import net.rim.device.api.ui.Graphics;
 
 public class GIFFUtility
 {
   private GIFEncodedImage image;
   private int current;
   private int count;
 
   public GIFFUtility(GIFEncodedImage image)
   {
     this.image = image;
     this.count = image.getFrameCount();
   }
 
   public void paint(Graphics graphics) {
     graphics.drawImage(this.image.getFrameLeft(this.current), this.image.getFrameTop(this.current), this.image.getFrameWidth(this.current), this.image.getFrameHeight(this.current), this.image, this.current, 0, 0);
   }
 
   public void resetPosition()
   {
     this.current = 0;
   }
 
   public void nextPosition() {
     this.current += 1;
 
     if (this.current == this.count)
       resetPosition();
   }
 
   public boolean hasNextPosition()
   {
     this.current += 1;
 
     return this.current != this.count;
   }
}

